cmake_minimum_required(VERSION 3.12)
message(STATUS "cmake version ${CMAKE_VERSION}")
project(legacy_drm)

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)

set(TOOLCHAIN_DIR /opt/gcc-aarch64-linux-gnu)

set(CMAKE_C_COMPILER ${TOOLCHAIN_DIR}/bin/aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_DIR}/bin/aarch64-linux-gnu-g++)

set(CMAKE_CXX_STANDARD 11)

add_definitions(-g -O0 -ggdb -gdwarf -funwind-tables -rdynamic)
add_definitions(-Wno-write-strings -Wno-return-type)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -Wall -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -Wall -fPIC")

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

set(LIBS drm)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib)

set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/test)

# set(APP legacy_drm)       # 编译传统模式
set(APP atomic_drm)         # 编译原子模式
add_executable(${APP} ${APP}.c)

target_link_libraries(${APP} ${LIBS})